import request from '@/utils/request'

// 按条件分页查询
export const getResourcePages = data => {
  return request({
    method: 'POST',
    url: '/boss/resource/getResourcePages',
    data
  })
}

// 删除资源
export const deleteResource = id => {
  return request({
    method: 'DELETE',
    url: `/boss/resource/category/${id}`
  })
}

// 查询资源分类接口
export const getResourceCategories = () => {
  return request({
    method: 'GET',
    url: '/boss/resource/category/getAll'
  })
}

// 给角色分配资源
export const allocateRoleResources = data => {
  return request({
    method: 'POST',
    url: '/boss/resource/allocateRoleResources'
  })
}

// 查询资源分类列表
export const getResourceList = resourceId => {
  return request({
    method: 'GET',
    url: '/boss/resource/category/getAll',
    params: {
      resourceId
    }
  })
}

export const getAll = () => {
  return request({
    method: 'GET',
    url: '/boss/resource/getAll'
  })
}

// 获取角色拥有的资源列表
export const getRoleResources = roleId => {
  return request({
    method: 'GET',
    url: '/boss/resource/getRoleResources',
    params: {
      roleId
    }
  })
}
